var Animal=function(name,age){
    //私有属性
    var _age=age;
    //保护属性
    var _color='黑色';
    this.getAge=function(){
        return _age;
    }
    Object.defineProperty(this,"color",{
        set:function(v){
            _color=v;
        },
        get:function(){
            return _color;
        }
    })
}
//原型属性,方法
Animal.prototype.sex=0;
Animal.prototype.play=function(){
    console.log('动物会玩耍...');
}
//类静态属性
Animal.num=99;
Animal.count=function(){
    console.log('种群数量',this.num);
}

let xh=new Animal("小黑",2);
console.log(xh.getAge());
console.log(xh.color);
console.log("性别",xh.sex);
xh.play();

console.log("动物类",Animal.num);
Animal.count();